/*
 * Class with static objects of FileAssistants.
 */
package filesystem;

import filesystem.exceptions.InvalidModelItemException;
import model.*;

/**
 *
 * @author ArieS
 */
public class Assistants {

    /**
     * Object of the TrackFileAssistant.
     */
    public static FileAssistant tFA = TrackFileAssistant.getInstance();
    /**
     * Object of the ArtistFileAssistant.
     */
    public static FileAssistant arFA = ArtistFileAssistant.getInstance();
    /**
     * Object of the GenreFileAssistant.
     */
    public static FileAssistant gFA = GenreFileAssistant.getInstance();
    /**
     * Object of the AlbumFileAssistant.
     */
    public static FileAssistant alFA = AlbumFileAssistant.getInstance();

    /**
     * 
     * @param item object of ModelItem.
     * @return FileAssistant of the desired type.
     * @throws InvalidModelItemException 
     */
    public static FileAssistant getFileAssistant(ModelItem item)
            throws InvalidModelItemException {
        if (item instanceof Album) {
            return alFA;
        }
        if (item instanceof Artist) {
            return arFA;
        }
        if (item instanceof Genre) {
            return gFA;
        }
        if (item instanceof Track) {
            return tFA;
        }
        throw new InvalidModelItemException();
    }
}
